Skip to content

Add LSP jar file system support - #2

Open
Manykeys wants to merge 13 commits into
mainfrom
jar-file-system
Open

Add LSP jar file system support#2
Manykeys wants to merge 13 commits into
mainfrom
jar-file-system

Conversation

@Manykeys

@Manykeys Manykeys commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Hi!
I wanted to try adding a feature that Arturm1 started in scalameta#4114. I think it's useful, so decided to pick it up. Logic and architecture reused from that PR

The idea is to add it as an experimental feature and get feedback on what to improve. I also plan to add a setting in VSCode to turn the feature on and off

Feature:

Adds a virtual file system metalsfs:// to the Metals LSP server. It allows you to browse JAR file contents directly in the VS Code sidebar — similar to "External Libraries" in IntelliJ IDEA. After project indexing, a folder called "Metals - Libraries" appears in Explorer with three sections: JDK sources, workspace JARs, and source JARs

How it works:

Server side (Scala):

  • URIMapper — converts jar:file:///path/cats.jar!/com/Foo.scala -> metalsfs:/metalsLibraries/jar/cats.jar/com/Foo.scala. It translates between internal Metals paths and virtual URIs for the client
  • LSPFileSystemProvider — handles three LSP commands from the client: readDirectory, readFile, stat. Uses Java NIO FileSystems to read JAR as a file system. .class files are decompiled using CFR
  • WorkspaceLspService got routing for the new commands and URI conversion in responses, so Go to Definition opens files through metalsfs://
  • After indexing, the server sends a metals-library-filesystem-ready notification to the client

Client side (TypeScript):

  • MetalsFileSystemProvider implements vscode.FileSystemProvider and sends requests to the server via LSP executeCommand
  • When it receives LibraryFileSystemReady, it registers the provider and adds the folder to the workspace
image

@Manykeys
Manykeys force-pushed the jar-file-system branch 2 times, most recently from 2034888 to f22c983 Compare May 26, 2026 19:11
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated configuration to expand base branch support for code review
processes.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/scalameta/metals/pull/8415?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…indexing, read JDK name from JAVA_HOME/release, make readFile non-blocking (flatMap, no Await), close Files.list via Using.resource, add non-exhaustive match fallbacks, move isUriEqual to MetalsEnrichments
dependabot Bot and others added 10 commits May 28, 2026 20:13
…calameta#8398)

Bumps
[webpack-dev-server](https://github.com/webpack/webpack-dev-server) from
5.2.2 to 5.2.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/webpack/webpack-dev-server/releases">webpack-dev-server's
releases</a>.</em></p>
<blockquote>
<h2>v5.2.4</h2>
<h3><a
href="https://github.com/webpack/webpack-dev-server/compare/v5.2.3...v5.2.4">5.2.4</a>
(2026-05-11)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>set Cross-Origin-Resource-Policy header to prevent source code theft
over HTTP</li>
</ul>
<h2>v5.2.3</h2>
<h3><a
href="https://github.com/webpack/webpack-dev-server/compare/v5.2.2...v5.2.3">5.2.3</a>
(2026-01-12)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>add <code>cause</code> for <code>errorObject</code> (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5518">#5518</a>)
(<a
href="https://github.com/webpack/webpack-dev-server/commit/37b033da2c48335178495a1987c469a26ef3de60">37b033d</a>)</li>
<li>compatibility with event target and universal target and lazy
compilation (<a
href="https://github.com/webpack/webpack-dev-server/commit/574026c44b9c51f0bbd2f5a2836c54607289a071">574026c</a>)</li>
<li><strong>overlay:</strong> add ESC key to dismiss overlay (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5598">#5598</a>)
(<a
href="https://github.com/webpack/webpack-dev-server/commit/f91baa8831e061e2998849966b8002b40b83fb07">f91baa8</a>)</li>
<li>progress indicator styles (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5557">#5557</a>)
(<a
href="https://github.com/webpack/webpack-dev-server/commit/41a53a1accdb0a90785d82cbe8a079794eeed3c8">41a53a1</a>)</li>
<li>upgrade selfsigned to v5</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/webpack/webpack-dev-server/blob/main/CHANGELOG.md">webpack-dev-server's
changelog</a>.</em></p>
<blockquote>
<h3><a
href="https://github.com/webpack/webpack-dev-server/compare/v5.2.3...v5.2.4">5.2.4</a>
(2026-05-11)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>set Cross-Origin-Resource-Policy header to prevent source code theft
over HTTP</li>
</ul>
<h3><a
href="https://github.com/webpack/webpack-dev-server/compare/v5.2.2...v5.2.3">5.2.3</a>
(2026-01-12)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>add <code>cause</code> for <code>errorObject</code> (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5518">#5518</a>)
(<a
href="https://github.com/webpack/webpack-dev-server/commit/37b033da2c48335178495a1987c469a26ef3de60">37b033d</a>)</li>
<li>compatibility with event target and universal target and lazy
compilation (<a
href="https://github.com/webpack/webpack-dev-server/commit/574026c44b9c51f0bbd2f5a2836c54607289a071">574026c</a>)</li>
<li><strong>overlay:</strong> add ESC key to dismiss overlay (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5598">#5598</a>)
(<a
href="https://github.com/webpack/webpack-dev-server/commit/f91baa8831e061e2998849966b8002b40b83fb07">f91baa8</a>)</li>
<li>progress indicator styles (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5557">#5557</a>)
(<a
href="https://github.com/webpack/webpack-dev-server/commit/41a53a1accdb0a90785d82cbe8a079794eeed3c8">41a53a1</a>)</li>
<li>upgrade selfsigned to v5</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/fd401308f1cc026262880e2dab810004d6444282"><code>fd40130</code></a>
chore(release): 5.2.4</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/ece4f3617bea31fb6d3833f69a32b6c289959a49"><code>ece4f36</code></a>
chore: update deps (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5661">#5661</a>)</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/a2161442a314a06a97e25d1404d08410cb4e9c51"><code>a216144</code></a>
ci: fix test (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5658">#5658</a>)</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/df073c53a8cefb54210b43813fa6ee60364a554e"><code>df073c5</code></a>
Merge commit from fork</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/b550a702bd4246d1724513b70de0bfbe6604672f"><code>b550a70</code></a>
chore(release): 5.2.3</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/9704dc52e3f696ae1446428c25882745e9b65cbb"><code>9704dc5</code></a>
chore: upgrade selfsigned to v5 and remove node-forge dependency (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5618">#5618</a>)</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/92bf644784741e8ea5adaa4a1dc26f4d462f223d"><code>92bf644</code></a>
chore: bump express to update qs (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5621">#5621</a>)</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/792b2f0bd13a3b93abf701fe3a5cf41ee16722f4"><code>792b2f0</code></a>
chore(deps-dev): bump the dependencies group with 4 updates (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5606">#5606</a>)</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/6d587cab3e023675de2feedf81bcdfcec7d5b774"><code>6d587ca</code></a>
chore(deps): bump the dependencies group across 1 directory with 27
updates (...</li>
<li><a
href="https://github.com/webpack/webpack-dev-server/commit/f91baa8831e061e2998849966b8002b40b83fb07"><code>f91baa8</code></a>
fix(overlay): add ESC key to dismiss overlay (<a
href="https://redirect.github.com/webpack/webpack-dev-server/issues/5598">#5598</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/webpack/webpack-dev-server/compare/v5.2.2...v5.2.4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=webpack-dev-server&package-manager=npm_and_yarn&previous-version=5.2.2&new-version=5.2.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/scalameta/metals/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Test execution over mcp would silently fail with no output, if the class
to test could not be found by the presentation compiler. This change
ensures the file with the test is compiled before attempting to find the
test.

In case a test lives in a class with a companion object, two
`Discovered` instances were potentially created, one for the class and
one for the object. Now the class is preferred over the object, such
that for class based test frameworks the companion is ignored, but for
module based frameworks such as ZIO test the module is uses, since no
class exists.

/fixes scalameta#8276
/fixes scalameta#8138

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Broader ZIO test framework compatibility to detect additional suite
types.

* **Bug Fixes**
  * Fixed duplicate test discovery by improving deduplication logic.
* Ensured source files are compiled before running tests to improve
execution reliability.
* Added error logging when compiler/type information is missing for test
suites.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/scalameta/metals/pull/8418?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
  * Updated test expectations for Java 21 compatibility.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/scalameta/metals/pull/8420?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Improved contributor guide wording for clearer setup and development
guidance across multiple sections.
* Clarified a plugin description to indicate integration via the Build
Server Protocol and its role in producing SemanticDB outputs.
  * Fixed a presentation typo in the cross-tests section.
* Rephrased instructions for updating build tool launchers/wrappers and
the sbt launcher to reduce ambiguity while preserving existing guidance
about launching tools not on the PATH.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/scalameta/metals/pull/8421?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…es (scalameta#8434)

Bumps the npm-dependencies group in /website with 4 updates:
[@easyops-cn/docusaurus-search-local](https://github.com/easyops-cn/docusaurus-search-local/tree/HEAD/packages/docusaurus-search-local),
[react](https://github.com/facebook/react/tree/HEAD/packages/react),
[react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom)
and
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).

Updates `@easyops-cn/docusaurus-search-local` from 0.55.1 to 0.55.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/easyops-cn/docusaurus-search-local/releases">@​easyops-cn/docusaurus-search-local's
releases</a>.</em></p>
<blockquote>
<h2>v0.55.2</h2>
<h2><a
href="https://github.com/easyops-cn/docusaurus-search-local/compare/v0.55.1...v0.55.2">0.55.2</a>
(2026-05-31)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>some languages need lunr wordcut (<a
href="https://github.com/easyops-cn/docusaurus-search-local/commit/1e60641f5d26399ec2407f5c36ea28f6a3048028">1e60641</a>)</li>
<li>some languages need lunr wordcut (<a
href="https://github.com/easyops-cn/docusaurus-search-local/commit/d87155582f62b1fb42377f3af0cfc17f8784ff47">d871555</a>),
closes <a
href="https://redirect.github.com/easyops-cn/docusaurus-search-local/issues/438">#438</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/easyops-cn/docusaurus-search-local/commits/v0.55.2/packages/docusaurus-search-local">compare
view</a></li>
</ul>
</details>
<br />

Updates `react` from 19.2.5 to 19.2.7
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/facebook/react/releases">react's
releases</a>.</em></p>
<blockquote>
<h2>19.2.7 (June 1st, 2026)</h2>
<h2>React Server Components</h2>
<ul>
<li>Fixed missing <code>FormData</code> entries in Server Actions which
regressed in 19.2.6
(<a
href="https://redirect.github.com/facebook/react/pull/36566">#36566</a>
by <a
href="https://github.com/unstubbable"><code>@​unstubbable</code></a>)</li>
</ul>
<h2>19.2.6 (May 6th, 2026)</h2>
<h2>React Server Components</h2>
<ul>
<li>Type hardening and performance improvements
(<a
href="https://redirect.github.com/facebook/react/pull/36425">#36425</a>
by <a href="https://github.com/eps1lon"><code>@​eps1lon</code></a> and
<a
href="https://github.com/unstubbable"><code>@​unstubbable</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/facebook/react/commit/6117d7cca4906492c51fe6a03381e35adfd86e7d"><code>6117d7c</code></a>
Version 19.2.7 (<a
href="https://github.com/facebook/react/tree/HEAD/packages/react/issues/36591">#36591</a>)</li>
<li><a
href="https://github.com/facebook/react/commit/eaf3e95ca92be7a23d3c9cc8ffd6f199a40be401"><code>eaf3e95</code></a>
Version 19.2.6</li>
<li>See full diff in <a
href="https://github.com/facebook/react/commits/v19.2.7/packages/react">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~GitHub%20Actions">GitHub Actions</a>, a new
releaser for react since your current version.</p>
</details>
<br />

Updates `react-dom` from 19.2.5 to 19.2.7
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/facebook/react/releases">react-dom's
releases</a>.</em></p>
<blockquote>
<h2>19.2.7 (June 1st, 2026)</h2>
<h2>React Server Components</h2>
<ul>
<li>Fixed missing <code>FormData</code> entries in Server Actions which
regressed in 19.2.6
(<a
href="https://redirect.github.com/facebook/react/pull/36566">#36566</a>
by <a
href="https://github.com/unstubbable"><code>@​unstubbable</code></a>)</li>
</ul>
<h2>19.2.6 (May 6th, 2026)</h2>
<h2>React Server Components</h2>
<ul>
<li>Type hardening and performance improvements
(<a
href="https://redirect.github.com/facebook/react/pull/36425">#36425</a>
by <a href="https://github.com/eps1lon"><code>@​eps1lon</code></a> and
<a
href="https://github.com/unstubbable"><code>@​unstubbable</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/facebook/react/commit/6117d7cca4906492c51fe6a03381e35adfd86e7d"><code>6117d7c</code></a>
Version 19.2.7 (<a
href="https://github.com/facebook/react/tree/HEAD/packages/react-dom/issues/36591">#36591</a>)</li>
<li><a
href="https://github.com/facebook/react/commit/eaf3e95ca92be7a23d3c9cc8ffd6f199a40be401"><code>eaf3e95</code></a>
Version 19.2.6</li>
<li>See full diff in <a
href="https://github.com/facebook/react/commits/v19.2.7/packages/react-dom">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~GitHub%20Actions">GitHub Actions</a>, a new
releaser for react-dom since your current version.</p>
</details>
<br />

Updates `@types/node` from 25.6.0 to 25.9.1
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Refined internal documentation with improved wording and grammar
clarifications.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
  * Updated Scala version to 3.8.4.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…a#8448)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **New Features**
* Enabled the GotoLog command, allowing users to quickly navigate to and
view application logs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants